"use client";
import {  Tabs } from "antd";
import { menuData } from "./data";
import { useRouter } from "next/navigation";
import "./css/a1.css"


export default function Menu(props:{url:string|string[]}) {
  const router = useRouter();
  return (
    <>
      <Tabs
        style={{padding: 0,width: "80px",height: "100%",background: "#ccc", boxSizing: "border-box"}}
        type="card"
        defaultActiveKey={'/'+props.url[1]}
        tabPosition="left"
        items={menuData}
        onChange={(key) => {
          let index=menuData.findIndex((item)=>item.key===key)
          if(key=="/home"){
            router.push(key)
          }else {
            router.push(menuData[index].key+menuData[index].children.props.items[0].key)
          }
          
        }}
      />
    </>
  );
}
